const elementResizeDetectorMaker = require('element-resize-detector')

export default {
  mounted() {
    // 绑定父元素缩放时，图表跟随变化
    this.domResize()
  },
  methods: {
    domResize () {
      const that = this
      const erd = elementResizeDetectorMaker()
      erd.listenTo(document.getElementById(that.wrapId), function(element) {
        that.$nextTick(function() {
          that.resize()
        })
      })
    }
  }
}
